package erfgame.core;

import java.io.Serializable;

public abstract class AbstractLongIdObject implements Serializable {
	
	private static final long serialVersionUID = 0;
	
	protected long id;
	
	public AbstractLongIdObject() {
	}
	
	public AbstractLongIdObject(long id) {
		this.id = id;
	}
	
	public long getId() {
		return this.id;
	}
	
	public int hashCode() {
		 return (int)this.id;
	 }
	 
	 public boolean equals( Object o ) {
		 if( o != null && o.getClass().equals( o.getClass() ) ) {
			 return equals( (AbstractLongIdObject)o );
		 } else {
			 return false;
		 }
	 }
	 
	 public boolean equals( AbstractLongIdObject o ) {
		return o.getId() == this.getId(); 
	 }

}
